#include<stack>
using namespace std;
class MinStack {
public:
    /** initialize your data structure here. */
    void push(int val) {
        st.push(val);
        if (minst.empty() || minst.top() >= val)
            minst.push(val);


    }

    void pop() {
        if (st.top() == minst.top())
            minst.pop();
        st.pop();
    }

    int top() { return st.top(); }

    int getMin() { return minst.top(); }
    stack<int> st;
    stack<int> minst;
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(x);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */